package figure8.GUI;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.sound.sampled.BooleanControl;
import javax.sound.sampled.Control;
import javax.sound.sampled.FloatControl;
import javax.swing.JButton;
import javax.swing.JLabel;

import figure8.Controller;
import figure8.MIDITrack;

/**
 * A track panel represents a distinct track in the project, and should be
 * composed of a panel with the controls for the track (pan, volume, etc) and a
 * panel to display the track (e.g waveform or midi notes).
 */
public class MIDITrackPanel extends TrackPanel {
	private JLabel test;
	private BooleanControl muteCont;
	private FloatControl volCont;
	private Control[] cntrls = null;
	private Pattern pattern;
	private Matcher matcher;

	public MIDITrackPanel(final Controller controller, final MIDITrack track) {
		super(track);
		pattern = pattern.compile(" ([A-Z]|[a-z]){1,8}(\\s|.|-)?([A-Z]|[a-z]){1,8}(\\s[0-9])?");
		matcher = pattern.matcher(track.getInstruments()[track.getInstrumentNumber()].toString());
		matcher.find();
		track.setName(matcher.group().toString());
		MIDITrackSettingsPanel panel = new MIDITrackSettingsPanel(controller, track);
		this.add(panel, BorderLayout.LINE_START);
		this.add(new MIDIGraph(track));
	}

	public void settings() {
	}
}
